<?php
namespace Api\Controller;
use Zend\Authentication\AuthenticationService;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Velacolib\Utility\Utility;
use Admin\Model\AdminTopicTable;
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
class IndexController extends AbstractActionController{
    protected $topicModel;
    protected $topiccatModel;
    public function onDispatch(\Zend\Mvc\MvcEvent $e)
    {
        //Utility::CheckLogin($this,'/login');
        $this->topicModel = Utility::UserGateway('Admin\Model\AdminTopicTable');
        $this->topiccatModel = Utility::UserGateway('Admin\Model\AdminCategoriesTable');
        $this->layout('frontend/layout');
        return parent::onDispatch($e);
    }

    public function init(){

    }

    public function indexAction()
    {
        $array_location = Utility::getLocationArray();
        $array_type =  Utility::getProductType();
        $topic_cat = Utility::UserGateway('Admin\Model\AdminCategoriesTable')->getAll();

        $return_array = array('loc'=>$array_location, 'type'=> $array_type, 'cat' => $topic_cat);
        echo  json_encode($return_array);
        die;

    }
    public function friendlistAction(){

    }

}
?>
